Launch environments
-
Launch environment supporting
EventKit
events. Expects bundle and file name for every file containing data of events to be added into calendar at test launch. Structure is defined in example project’s file events.json.Example:
let recurringEvents: EventLaunchEnvironment = [ LaunchEnvironmentResourceValue(fileName: "monthly_events", bundleName: "Data") ] let nearEvents = EventLaunchEnvironment(resources: (fileName: "todays_events", bundleName: "Test data"), (fileName: "this_week_events", bundleName: nil)) let nearEvents = EventLaunchEnvironment(shouldCleanBefore: true, resources: (fileName: "todays_events", bundleName: "Test data"), (fileName: "this_week_events", bundleName: nil))
Warning
SettingshouldCleanBefore
totrue
will remove all events from a device.Declaration
Swift
public struct EventLaunchEnvironment : CleanableLaunchEnvironmentWithMultipleValues, AutoMateLaunchEnvironment
-
Launch environment supporting
EventKit
reminders. Expects bundle and file name for every file containing data of reminders to be added into calendar at test launch. Structure is defined in example project’s file reminders.json.Example:
let recurringReminders: ReminderLaunchEnvironment = [ LaunchEnvironmentResourceValue(fileName: "johnys_birthday_reminder", bundleName: "Data") ] let highPriorityReminders = ReminderLaunchEnvironment(resources: (fileName: "automate_release_reminders", bundleName: "Test data"), (fileName: "wwdc_reminders", bundleName: nil)) let highPriorityReminders = ReminderLaunchEnvironment(shouldCleanBefore: true, resources: (fileName: "automate_release_reminders", bundleName: "Test data"), (fileName: "wwdc_reminders", bundleName: nil))
Warning
SettingshouldCleanBefore
totrue
will remove all reminders from a device.Declaration
Swift
public struct ReminderLaunchEnvironment : CleanableLaunchEnvironmentWithMultipleValues, AutoMateLaunchEnvironment
-
Launch environment supporting
Contacts
. Expects bundle and file name for every file containing data of contacts to be added to address book at test launch. Structure is defined in example project’s file contacts.json.Example:
let johnContacts: ContactLaunchEnvironment = [ LaunchEnvironmentResourceValue(fileName: "john", bundleName: "Data") ] let severalContacts = ContactLaunchEnvironment(resources: (fileName: "michael", bundleName: "Test data"), (fileName: "emma", bundleName: nil)) let severalContacts = ContactLaunchEnvironment(shouldCleanBefore: true, resources: (fileName: "michael", bundleName: "Test data"), (fileName: "emma", bundleName: nil))
Warning
SettingshouldCleanBefore
totrue
will remove all contacts from a device.Declaration
Swift
public struct ContactLaunchEnvironment : CleanableLaunchEnvironmentWithMultipleValues, AutoMateLaunchEnvironment
-
Launch environment disabling
UIKit
animation.Example:
See morelet disableAnimation = AnimationLaunchEnvironment()
Declaration
Swift
public struct AnimationLaunchEnvironment : LaunchEnvironmentWithSingleValue, AutoMateLaunchEnvironment
-
Launch environment informing application that is running in UI test.
Example:
See morelet isInUITest = IsInUITestLaunchEnvironment()
Declaration
Swift
public struct IsInUITestLaunchEnvironment : LaunchEnvironmentWithSingleValue, AutoMateLaunchEnvironment
-
Protocol adapted by all launch enviroment options predefined in
See moreAutoMate
. It also assures that default handling is provided by AutoMate - AppBuddy.Declaration
Swift
public protocol AutoMateLaunchEnvironment
-
Simple implementation of
LaunchEnvironment
that wraps single(key: value)
pair forTestLauncher
.Example:
See morelet launchEnvironmentOption = LaunchEnvironment(key: "MADE_WITH_LOVE_BY", value: "PGS")
Declaration
Swift
public struct LaunchEnvironment : LaunchEnvironmentProtocol
-
Most basic and generic structure to pass
(key: value)
pairs throughTestLauncher
.Example:
See morelet launchEnvironmentDictionary: LaunchEnvironments = ["CORPORATION_KEY": "PGS", "PROJECT_KEY": "AutoMate"]
Declaration
Swift
public struct LaunchEnvironments : LaunchEnvironmentProtocol, ExpressibleByDictionaryLiteral
-
Protocol defining minimal requirements of launch environment option to be handled by framework.
Example:
public struct SimpleLaunchEnvironment: LaunchEnvironmentProtocol { public typealias Value = String public let value: String public var launchEnvironments: [String : String]? { return [uniqueIdentifier: value] } public init(value: String) { self.value = value } }
Note
internal
initializer would be generated automatically but it would not fulfill requirement ofpublic
protocol.Declaration
Swift
public protocol LaunchEnvironmentProtocol : LaunchOption
-
Protocol defining minimal requirements for launch environment option with single values. Provides default implementation for handling singe launch environment by providing
key
andvalue
.Example:
See morepublic struct SimpleLaunchEnvironment: LaunchEnvironmentWithSingleValue { public typealias Value = String public let key = "LAUNCH_KEY" public var value: String } let simple = SimpleLaunchEnvironment(value: "LaunchValue")
Declaration
Swift
public protocol LaunchEnvironmentWithSingleValue : LaunchEnvironmentProtocol
-
Protocol defining minimal requirements for launch environment option with multiple values. Provides default implementation for
ExpressibleByArrayLiteral
protocol.Example:
public struct ArrayLaunchEnvironment: LaunchEnvironmentWithMultipleValues { public typealias Value = String public let valuesCollection: [String] public init(valuesCollection: [Value]) { self.valuesCollection = valuesCollection } } let array = ArrayLaunchEnvironment(valuesCollection: ["Value1", "Value2"]) let array = ["Value1", "Value2"] as ArrayLaunchEnvironment
Note
internal
initializer would be generated automatically but it would not fulfill requirement ofpublic
protocol.Declaration
Swift
public protocol LaunchEnvironmentWithMultipleValues : LaunchEnvironmentProtocol, ExpressibleByArrayLiteral
-
Protocol to be adapted by all
LaunchEnvironment
options that give ability to clean present data before saving new. To work as expected it requires handing special flag appended at the beginning oflaunchEnvironment
value. It is implemented by predefined inAutoMate
options and assures that default handling is provided by AutoMate - AppBuddyExample:
See morepublic struct CleanableSimpleLaunchEnvironment: CleanableLaunchEnvironment, LaunchEnvironmentWithSingleValue { public typealias Value = String public let key = "LAUNCH_KEY" public var value: String var shouldCleanBefore: Bool }
Declaration
Swift
public protocol CleanableLaunchEnvironment : LaunchEnvironmentProtocol
-
CleanableLaunchEnvironment
specialized for launch environment options with multiple values. If predefined inAutoMate
option implementsLaunchEnvironmentWithMultipleValues
and it’s specific enables clean data before saving new one, it conforms to this protocol. It provides few initializers extendingLaunchEnvironmentWithMultipleValues
initializers.Example:
public struct CleanableArrayLaunchEnvironment: CleanableLaunchEnvironmentWithMultipleValues { public typealias Value = String public let valuesCollection: [String] public let shouldCleanBefore: Bool public init(shouldCleanBefore: Bool, valuesCollection: [Value]) { self.valuesCollection = valuesCollection self.shouldCleanBefore = shouldCleanBefore } }
Note
internal
initializer would be generated automatically but it would not fulfill requirement ofpublic
protocol.Declaration
Swift
public protocol CleanableLaunchEnvironmentWithMultipleValues : CleanableLaunchEnvironment, LaunchEnvironmentWithMultipleValues
-
Contains basic requirements for type that will be used as value for launch environment.
Example:
See morepublic enum DataSource: String, LaunchEnvironmentValue { case valid = "mock_valid" case error = "mock_error" }
Declaration
Swift
public protocol LaunchEnvironmentValue
-
Launch environment resource model containing informations required to point proper file containing resource data. Expects bundle and file name. If bundle name is
nil
main bundle will be searched.Example:
See morelet resource = LaunchEnvironmentResourceValue(fileName: "monthly_events", bundleName: "Data")
Declaration
Swift
public struct LaunchEnvironmentResourceValue : LaunchEnvironmentValue